/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.swt.mto.thithu.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import com.swt.mto.thithu.model.Answer;

import java.io.Serializable;

import java.util.Date;

/**
 * The cache model class for representing Answer in entity cache.
 *
 * @author tuan.nguyen
 * @see Answer
 * @generated
 */
public class AnswerCacheModel implements CacheModel<Answer>, Serializable {
	@Override
	public String toString() {
		StringBundler sb = new StringBundler(21);

		sb.append("{answerId=");
		sb.append(answerId);
		sb.append(", questionId=");
		sb.append(questionId);
		sb.append(", createUserId=");
		sb.append(createUserId);
		sb.append(", modifyUserId=");
		sb.append(modifyUserId);
		sb.append(", decription=");
		sb.append(decription);
		sb.append(", answerType=");
		sb.append(answerType);
		sb.append(", correct=");
		sb.append(correct);
		sb.append(", answerPosition=");
		sb.append(answerPosition);
		sb.append(", createDate=");
		sb.append(createDate);
		sb.append(", modifydate=");
		sb.append(modifydate);
		sb.append("}");

		return sb.toString();
	}

	public Answer toEntityModel() {
		AnswerImpl answerImpl = new AnswerImpl();

		answerImpl.setAnswerId(answerId);
		answerImpl.setQuestionId(questionId);
		answerImpl.setCreateUserId(createUserId);
		answerImpl.setModifyUserId(modifyUserId);

		if (decription == null) {
			answerImpl.setDecription(StringPool.BLANK);
		}
		else {
			answerImpl.setDecription(decription);
		}

		answerImpl.setAnswerType(answerType);

		if (correct == null) {
			answerImpl.setCorrect(StringPool.BLANK);
		}
		else {
			answerImpl.setCorrect(correct);
		}

		answerImpl.setAnswerPosition(answerPosition);

		if (createDate == Long.MIN_VALUE) {
			answerImpl.setCreateDate(null);
		}
		else {
			answerImpl.setCreateDate(new Date(createDate));
		}

		if (modifydate == Long.MIN_VALUE) {
			answerImpl.setModifydate(null);
		}
		else {
			answerImpl.setModifydate(new Date(modifydate));
		}

		answerImpl.resetOriginalValues();

		return answerImpl;
	}

	public long answerId;
	public long questionId;
	public long createUserId;
	public long modifyUserId;
	public String decription;
	public int answerType;
	public String correct;
	public int answerPosition;
	public long createDate;
	public long modifydate;
}